package com.example.android.dialog;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class dialog extends Activity {
    /** Called when the activity is first created. */
    
	@Override
	protected Dialog onCreateDialog(int id) {
      LayoutInflater dialoglayout = LayoutInflater.from(this);
      final View textEntryView = dialoglayout.inflate(R.layout.dialog, null);
      return new AlertDialog.Builder(dialog.this)
        .setIcon(R.drawable.dialog_icon)
        .setTitle(R.string.dialog_text)
        .setView(textEntryView)
           
        .setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() {
          	public void onClick(DialogInterface dialog, int whichButton) {     
            }
        })
        .setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
            }
        })
        .create();
	}
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        
        Button textEntry = (Button) findViewById(R.id.dialog_button);
        textEntry.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                showDialog(0);
            }    
    }); 
}}